class times{
    // 可以根据时间戳 转换成 时间 20230824090000  
    static getFormatTimeFull(time,monthStr="-",hoursStr=":",yh=" "){
        let year = new Date(time).getFullYear()
        let month = new Date(time).getMonth()+1>9?new Date(time).getMonth()+1:'0'+(new Date(time).getMonth()+1)
        let day = new Date(time).getDate()>9?new Date(time).getDate():'0'+new Date(time).getDate()
        let hour = new Date(time).getHours()>9?new Date(time).getHours():'0'+new Date(time).getHours()
        let min = new Date(time).getMinutes()>9?new Date(time).getMinutes():'0'+new Date(time).getMinutes()
        let s = new Date(time).getSeconds()>9?new Date(time).getSeconds():'0'+new Date(time).getSeconds()
        return year+monthStr+month+monthStr+day+yh+hour+hoursStr+min+hoursStr+min
    }

    // 根据时间戳 获取 年月日
    static getFormatYmd(time,monthStr="-"){
        let year = new Date(time).getFullYear()
        let month = new Date(time).getMonth()+1>9?new Date(time).getMonth()+1:'0'+(new Date(time).getMonth()+1)
        let day = new Date(time).getDate()>9?new Date(time).getDate():'0'+new Date(time).getDate()
        return year+monthStr+month+monthStr+day
    }
    // 获取时分秒
    static getFormatTimeHis(time,hoursStr=":"){
        let hour = new Date(time).getHours()>9?new Date(time).getHours():'0'+new Date(time).getHours()
        let min = new Date(time).getMinutes()>9?new Date(time).getMinutes():'0'+new Date(time).getMinutes()
        let s = new Date(time).getSeconds()>9?new Date(time).getSeconds():'0'+new Date(time).getSeconds()
        return hour+hoursStr+min+hoursStr+min
    }

    // 将格式化时间 转换为时间戳 精确到秒
    static formatTimes(dates){
        return Math.floor(new Date(dates).getTime()/1000)
    }
}
module.exports=times